static char *andopt = NULL;
static double hdopf;
static double vdopf;
+static gpsdata_type what;
+static route_head *head;
static
arglist_t fix_args[] = {
del = delh || delv;
if (del) {
- waypt_del(waypointp);
+ switch(what) {
+ case wptdata:
+ waypt_del(waypointp);
+ break;
+ case trkdata:
+ track_del_wpt(head, waypointp);
+ break;
+ case rtedata:
+ route_del_wpt(head, waypointp);
+ break;
+ default:
+ return;
+ }
waypt_free(waypointp);
}
}
static void
-fix_process_track(const route_head *trk)
+fix_process_head(const route_head *trk)
{
- waypoint * waypointp;
- queue *elem, *tmp;
-
- QUEUE_FOR_EACH((queue *)&trk->waypoint_list, elem, tmp) {
- waypointp = (waypoint *)elem;
-
- fix_process_wpt(waypointp);
- }
+ head = (route_head *)trk;
}
static void
fix_process(void)
{
// Filter waypoints.
+ what = wptdata;
waypt_disp_all(fix_process_wpt);
// Filter tracks
- track_disp_all(fix_process_track, NULL, NULL);
+ what = trkdata;
+ track_disp_all(fix_process_head, NULL, fix_process_wpt);
// And routes
- route_disp_all(fix_process_track, NULL, NULL);
+ what = rtedata;
+ route_disp_all(fix_process_head, NULL, fix_process_wpt);
}
}
route_del_wpt( (route_head *)(void *)rte,
(waypoint *)(void *)(xte_recs[i].intermed->wpt));
+ waypt_free((waypoint *)(void *)(xte_recs[i].intermed->wpt));
if ( xte_recs[i].intermed->prev ) {
xte_recs[i].intermed->prev->next = xte_recs[i].intermed->next;
wpt = (waypoint *)elem;
buff[j++] = waypt_dupe(wpt);
track_del_wpt(track, wpt);
+ waypt_free(wpt);
}
if (track != master) /* i > 0 */
track_del_head(track);
}
if (curr != NULL)
{
- wpt = waypt_dupe(buff[j]);
- track_del_wpt(master, buff[j]);
+ wpt = buff[j];
+ track_del_wpt(master, wpt);
track_add_wpt(curr, wpt);
buff[j] = wpt;
}
if ((wpt->creation_time < start) || (wpt->creation_time > stop))
{
track_del_wpt(track, wpt);
+ waypt_free(wpt);
dropped++;
}
}